﻿<!DOCTYPE html>
<html lang="en">
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./site.css" rel="stylesheet">
<title>image/png</title>
</head>
<body>
<div class="container">
    <h2 id="pkg-overview">package png</h2>
    <p><code>import "image/png"</code>
    <p>png包实现了PNG图像的编解码。PNG格式参见：<a href="http://www.w3.org/TR/PNG/">http://www.w3.org/TR/PNG/</a></p>
    <h3 id="pkg-index" class="section-header">Index <a class="permalink" href="#pkg-index">&para;</a></h3>
    <a href="../main.html"><h3>返回首页</h3></a>
		</br>
        <li><a href="#FormatError">type FormatError</a></li>
        <ul>
            <li><a href="#FormatError.Error">func (e FormatError) Error() string</a></li>
        </ul>
        <li><a href="#UnsupportedError">type UnsupportedError</a></li>
        <ul>
            <li><a href="#UnsupportedError.Error">func (e UnsupportedError) Error() string</a></li>
        </ul>
        <li><a href="#Decode">func Decode(r io.Reader) (image.Image, error)</a></li>
        <li><a href="#DecodeConfig">func DecodeConfig(r io.Reader) (image.Config, error)</a></li>
        <li><a href="#Encode">func Encode(w io.Writer, m image.Image) error</a></li>
    </ul>
    <h3 id="FormatError">type <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#90">FormatError</a> <a class="permalink" href="#pkg-index">&para;</a></h3>
    <pre>type FormatError <a href="builtin.htm#string">string</a></pre>
    <p>当输入流不是合法的png格式图像时，就会返回FormatError类型的错误。</p>
    <h4 id="FormatError.Error">func (FormatError) <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#92">Error</a> <a class="permalink" href="#pkg-index">&para;</a></h4>
    <pre class="funcdecl">func (e <a href="#FormatError">FormatError</a>) Error() <a href="builtin.htm#string">string</a></pre>
    <h3 id="UnsupportedError">type <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#97">UnsupportedError</a> <a class="permalink" href="#pkg-index">&para;</a></h3>
    <pre>type UnsupportedError <a href="builtin.htm#string">string</a></pre>
    <p>当输入流使用了合法但尚不支持的png特性的时候，就会返回UnsupportedError类型的错误。</p>
    <h4 id="UnsupportedError.Error">func (UnsupportedError) <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#99">Error</a> <a class="permalink" href="#pkg-index">&para;</a></h4>
    <pre class="funcdecl">func (e <a href="#UnsupportedError">UnsupportedError</a>) Error() <a href="builtin.htm#string">string</a></pre>
    <h3 id="Decode">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#619">Decode</a> <a class="permalink" href="#pkg-index">&para;</a></h3>
    <pre class="funcdecl">func Decode(r <a href="io.htm">io</a>.<a href="io.htm#Reader">Reader</a>) (<a href="image.htm">image</a>.<a href="image.htm#Image">Image</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>从r读取一幅png格式的图像并解码返回该图像。图像的具体类型要看png文件的内容而定。</p>
    <h3 id="DecodeConfig">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/reader.go?name=release#643">DecodeConfig</a> <a class="permalink" href="#pkg-index">&para;</a></h3>
    <pre class="funcdecl">func DecodeConfig(r <a href="io.htm">io</a>.<a href="io.htm#Reader">Reader</a>) (<a href="image.htm">image</a>.<a href="image.htm#Config">Config</a>, <a href="builtin.htm#error">error</a>)</pre>
    <p>返回PNG图像的色彩模型和尺寸；函数不会解码整个图像。</p>
    <h3 id="Encode">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/image/png/writer.go?name=release#433">Encode</a> <a class="permalink" href="#pkg-index">&para;</a></h3>
    <pre class="funcdecl">func Encode(w <a href="io.htm">io</a>.<a href="io.htm#Writer">Writer</a>, m <a href="image.htm">image</a>.<a href="image.htm#Image">Image</a>) <a href="builtin.htm#error">error</a></pre>
    <p>将图像m以PNG格式写入w。任意图像类型都可以被编码，但image.NRGBA以外格式的图像可能会在编码时丢失一些图像信息。</p>
</div>
</body>
</html>
